<template>
  <Select v-bind="$attrs">
    <SelectOption v-for="(item, index) in roleList"
                  :key="index"
                  :value="String(item.roleId)">{{
      item.roleName
    }}</SelectOption>
  </Select>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
import { Select } from 'ant-design-vue';
import { GetRoleApi } from '/@/api/set/account';
export default defineComponent({
  name: 'RoleSelect',
  components: {
    Select,
    SelectOption: Select.Option,
  },
  setup() {
    let roleList = ref<any[]>([]);

    function getRoleList() {
      GetRoleApi().then((res) => {
        if (res.code === 200) {
          roleList.value = res.data;
        }
      });
    }
    getRoleList();

    return {
      roleList,
    };
  },
});
</script>
<style lang="less" scoped></style>
